package org.example.demos.pattern.chain_pattern_reference;

import org.springframework.stereotype.Component;

/**
 * 支付环节账号校验---实名制、未成年
 */
@Component
public class PayByAccountChecker extends AbstractChecker implements IChecker {
//
//    @Resource
//    private SubAccountService subAccountService;
	
	// 标识当前校验器的code
    @Override
    public String getCheckCode() {
        return CheckerConfig.PAY_ACCOUNT_CHECKER_CODE;
    }
	
    @Override
    public void action(CheckParam checkParam, CheckContext checkContext) {
//        Result result = null;
//        try {
//			// 校验开关
//            if (!ConfigManager.getBoolean("pay.account.check.switch", true)) {
//                return;
//            }
//			// 基本参数校验
//            if (preCheck(checkParam)) {
//                return;
//            }
//			// 支付插件版本判断
//            if (StringUtils.isNotBlank(checkParam.getSdkVersion()) && APKVersionComparetor.compareVersion(checkParam.getSdkVersion(), "4.8.0") < 0
//                    && ConfigManager.get("pay.account.check.lowapk.apptype", "5").contains(checkParam.getAppBigType())) {
//                checkContext.setResult(getCheckCode(), CheckResult.fail(TradeLimitCodeEnum.FORBID_PAY, "支付安全插件版本较低，请前往应用商店升级"));
//                return;
//            }
//			// 对支付环节账号的校验逻辑
////            result = subAccountService.checkPayLimit(buildPayInfo(checkParam), buildPayHistory(checkParam));
//        } catch (Exception e) {
////            log.error("PayByAccountChecker_action_error.", e);
//        }
//        buildResult(getCheckCode(), result, checkContext);
    }
 
}